PR: Implement Unified Error Handling Framework closes #74 - #116
Merged
Conversation
…acts - Added detailed error enums with descriptive variants to bridge, compliance_registry, escrow, fees, property-token, and traits contracts - Implemented core::fmt::Display for all error enums for human-readable messages - Integrated ContractError trait implementations providing error codes, descriptions, and categories - Improved error coverage by adding specific errors like Unauthorized, NotFound, InsufficientFunds, InvalidConfig, and others relevant to each contract domain - Enhanced cross-contract consistency in error handling and reporting mechanisms
|
@ChukwuemekaP1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
LaGodxy
approved these changes
Mar 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implemented a comprehensive, type-safe error handling system across all PropChain smart contracts with numeric error codes, Display implementations, and detailed documentation.
Changes
New Files:
contracts/traits/src/errors.rs - Core error framework with:
ContractError trait (error codes, descriptions, categories)
CommonError enum for shared errors
Numeric error code constants (1-6999 by category)
Updated Contracts:
✅ PropertyToken - 27 error variants with docs & codes
✅ Escrow - 13 error variants with docs & codes
✅ Bridge - 12 error variants with docs & codes
✅ Fees - 8 error variants with docs & codes
✅ ComplianceRegistry - 11 error variants with docs & codes
✅ Oracle - 11 error variants with docs & codes
Key Features
Numeric error codes for external API integration
Full Display impl on all error types
Documented error variants with causes and recovery guidance
Type-safe errors (no Result<T, String>)
Consistent patterns across all contracts
Testing
All contracts compile successfully with no warnings. No business logic changed—only error handling patterns enhanced.
closes #74